<template>
  <div id="app">
    <!-- this is App -->
    <!-- <button @click="transMsg">传你</button>
    <m-parent :msga="a" :msgb="b" :msgc="c"></m-parent> -->
    <!-- <router-link to="/home">home</router-link> -->
    <!-- <button @click="toHome">toHome</button> -->
    <router-view></router-view>
  </div>
</template>
<script>
import MParent  from './views/Parent.vue'
import bus from './util/bus'
export default{
  components: {
    MParent,
  },
  data() {
    return {
      a: 'msga',
      b: 'msgb',
      c: 'msgc',
    }
  },
  methods: {
    transMsg() {
      // 使用事件总线方式在非父子组件之间传递共享数据
      // 
      bus.$emit('AppTransMsg','i am from App Msg')
    },
    toHome(){
      // 编程式导航
      // this.$router.push({path:'/home',query:{name:'Jack'}})
      // 注意点：编程式导航传递参数搭配  path 和 query搭配  name 和 params搭配
      this.$router.push({name:'home',params:{id:3}})
    }
  },
}
</script>
<style>
</style>
